package iot.wlink.network.protocols;

import java.util.HashSet;
import java.util.Set;

/**
 * @author : willian fu
 * @date : 2021/8/21
 */
public class NetworkComponentStater {

    public static final NetworkComponentStater INSTANCE = new NetworkComponentStater();

    private static final Set<NetworkComponent> components = new HashSet<>();

    private NetworkComponentStater(){}

    public NetworkComponentStater regServer(NetworkComponent component){
        components.add(component);
        return this;
    }

    public NetworkComponentStater initAll(){
        components.forEach(NetworkComponent::initialize);
        return this;
    }

    public void stater(){
        components.forEach(NetworkComponent::stater);
    }
}
